/*
 * =====================================================================================
 *
 *       Filename:  teris.h
 *
 *    Description:  程序定义了一个方块类
 *
 *        Version:  1.0
 *        Created:  2008年11月05日 21时48分03秒
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Dr. Fritz Mehner (mn), mehner@fh-swf.de
 *        Company:  FH Südwestfalen, Iserlohn
 *
 * =====================================================================================
 */
#ifndef _CTERIS
#define _CTERIS

//#include "point.h"
#include "config.h"

extern const unsigned teris[7][4][4][4]; 
unsigned *ClearMap(unsigned *_map);
class CTeris
{
	public:
		CTeris();
		CTeris(unsigned _type, unsigned _faceto, unsigned _x, unsigned _y);
		CTeris(CTeris &_teris);
		~CTeris();
	public:
		virtual void display_me(); //显示方块
		virtual bool turn_left(unsigned *_map); //相左旋转
		virtual bool turn_right(unsigned *_map); //向右旋转
	public:
		virtual bool go_left(unsigned *_map); 	//左移
		virtual bool go_right(unsigned *_map); 	//右移
		virtual bool go_down(unsigned *_map); 	//向下
	public:
		//判断方块是否可以移动,旋转
		virtual bool Possible(unsigned _x,unsigned _y, unsigned _type, unsigned _faceto, unsigned *_map);
//		virtual bool go_buttom(void *_map); 	//到底
	public:
		virtual unsigned get_X() const
		{
			return m_X;
		}
		virtual unsigned get_Y() const
		{
			return m_Y;
		}
		virtual void Set_X(const unsigned &_x)
		{
			m_X = _x;
		}
		virtual void Set_Y(const unsigned &_y)
		{
			m_Y = _y;
		}
		virtual unsigned *Get_teris()
		{
			return m_teris;
		}
//		virtual bool showme(void *_map); 		//显示自己
//		virtual void clearme(void *_map); 	//擦除自己
//		virtual unsigned gettype();
//		virtual unsigned getcolor();
//		virtual my_point* getpoint(); //得到点指针
	public:
		unsigned m_type; //类型
		unsigned m_faceto;//方向
		unsigned m_X; //方块左角在地图上的位置
		unsigned m_Y; //方块上角在地图上的位置
		unsigned *m_teris; //方块的指针,指向一个常量数组
};
#endif
